package cn.huaqingcheng.tianshu.infrastructure.uc;

import cn.huaqingcheng.tianshu.core.uc.model.Account;
import cn.huaqingcheng.tianshu.core.uc.model.AccountKeyValue;
import cn.huaqingcheng.tianshu.core.uc.model.AccountPassword;
import cn.huaqingcheng.tianshu.infrastructure.uc.entity.AccountEntity;
import cn.huaqingcheng.tianshu.infrastructure.uc.entity.AccountKeyValueEntity;
import cn.huaqingcheng.tianshu.infrastructure.uc.entity.AccountPasswordEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * UcConvert
 */
@Mapper
public interface UcConvert {

    UcConvert INSTANCE = Mappers.getMapper(UcConvert.class);

    @Mapping(target = "password", ignore = true)
    Account toModel(AccountEntity entity);

    @Mapping(target = "updatedAt", ignore = true)
    @Mapping(target = "isDel", ignore = true)
    AccountEntity toEntity(Account model);

    AccountPassword toModel(AccountPasswordEntity entity);

    @Mapping(target = "updatedAt", ignore = true)
    @Mapping(target = "isDel", ignore = true)
    AccountPasswordEntity toEntity(AccountPassword model);


    AccountKeyValue toModel(AccountKeyValueEntity entity);

    AccountKeyValueEntity toEntity(AccountKeyValue model);

}
